<?php
namespace app\agency\model;
use think\Model;
class AgencyAdmin extends Model
{
	public function login($data){
		$user=db('agency_admin')->where('username',$data['username'])->find();
		if($user){
			if($user['pwd'] == md5($data['password'])){
				session('ag_username',$user['username']);   //机构管理员名称
				session('ag_aid',$user['agency_admin_id']); //机构管理员ID
				session('agency_id',$user['agency_id']);    //机构id
				session('is_admin',$user['is_admin']);      //是否是机构 超级管理员
				return 1; //信息正确
			}else{
				return -1; //密码错误
			}
		}else{
			return -1; //用户不存在
		}
	}

}
